package genetic.treenodes;

import genetic.Arity;
import genetic.DataSet;
import genetic.GPTreeNode;

public class Constant extends GPTreeNode implements Cloneable {

	private double value;
	
	public Constant(double value) {
		this.value = value;
	}
	
	@Override
	public double getValue(DataSet ds) {
		return value;
	}

	@Override
	public Arity getArity() {
		return Arity.zero;
	}

	public Constant clone() {
		Constant clone = (Constant)super.clone();
		clone.value = this.value;
		return clone;
	}

	/* (non-Javadoc)
	 * @see javax.swing.tree.TreeNode#getAllowsChildren()
	 */
	@Override
	public boolean getAllowsChildren() {
		return false;
	}

	/* (non-Javadoc)
	 * @see javax.swing.tree.TreeNode#isLeaf()
	 */
	@Override
	public boolean isLeaf() {
		return true;
	}
	
}
